/**
 * 设置压力测试
 * 压力测试无法实现通过script引用的js中包含require
 * 替代方案为使用cmd全局安装loadtest手动测试
 */
var loadtest = require("loadtest");
var expect = require("chai").expect;
suite("Stress tests", function() {
  test("Homepage should handle 100 requests in a second", function(done) {
    var options = {
      url: "http://localhost:3000",
      concurrency: 4,
      maxRequests: 100
    };
    loadtest.loadTest(options, function(err, result) {
      expect(!err);
      expect(result.totalTimeSeconds < 1);
      done();
    });
  });
});
